 

function topListAdditionCtrl($scope, $rootScope, $http, paFetchService) {
  'ngInject';

  this.reasonAddition = false; // 显示申报简介提示字数

  // textarea change事件
  this.checkText = () => {
    if(this.topList.reason.length > '400'){
      this.reasonAddition = true;
    }else {
      this.reasonAddition = false;
    }
  }
  
  // 提交表单
  this.submit = (param) => {
    // 修改表单是否提交过状态
    param.$submitted = true;

    // 表单校验
    if (param.$invalid) {
      return false;
    }

    $http.post(`${SERVER_CONTEXT}/api/redBlack/redBlackList/insert`,
      this.topList
        )
      .then((resp) => {
        if(resp.data.success){
          layer.msg(resp.data.message);
          $state.go('topList');
        }
      });
  };

  // 重置
  this.reset = () => {
    this.topList = {};
  }

  // 初始化页面
  this.initPage = () => {  	
    // 获得施工队list             
    paFetchService
                  .getTeamWithOrgList()
                  .then((resp) => {
                    this.teamWithOrgList = resp.data;
                  });
  }
  
  this.initPage();


}

export default topListAdditionCtrl;